function C57_CPP_cdf_plot_rm(Data_Summary)
%% C57 saline data
C5_saline_RM = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'C57_5') && strcmp(Data_Summary(n).drug,'saline') && Data_Summary(n).Mobility_Session1_Pass == 1 && Data_Summary(n).Mobility_Session2_Pass == 1 && isempty(C5_saline_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C5_saline_RM = RM;
        C5_saline_Shuffle = RM_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'C57_5') && strcmp(Data_Summary(n).drug,'saline')   && ~isempty(C5_saline_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C5_saline_RM = cat(1,C5_saline_RM,RM);
        C5_saline_Shuffle = cat(1,C5_saline_Shuffle,RM_Shuffle);
    end
end
[C5sf,C5sx,C5slow,C5shigh] = ecdf(C5_saline_RM,'Function','cdf','Alpha',0.05);
[C5ssf,C5ssx,C5sslow,C5sshigh] = ecdf(C5_saline_Shuffle,'Function','cdf','Alpha',0.05);

C6_saline_RM = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'C57_6') && strcmp(Data_Summary(n).drug,'saline') && Data_Summary(n).Mobility_Session1_Pass == 1 && Data_Summary(n).Mobility_Session2_Pass == 1 && isempty(C6_saline_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C6_saline_RM = RM;
        C6_saline_Shuffle = RM_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'C57_6') && strcmp(Data_Summary(n).drug,'saline')   && ~isempty(C6_saline_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C6_saline_RM = cat(1,C6_saline_RM,RM);
        C6_saline_Shuffle = cat(1,C6_saline_Shuffle,RM_Shuffle);
    end
end
[C6sf,C6sx,C6slow,C6shigh] = ecdf(C6_saline_RM,'Function','cdf','Alpha',0.05);
[C6ssf,C6ssx,C6sslow,C6sshigh] = ecdf(C6_saline_Shuffle,'Function','cdf','Alpha',0.05);

C7_saline_RM = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'C57_7') && strcmp(Data_Summary(n).drug,'saline') && Data_Summary(n).Mobility_Session1_Pass == 1 && Data_Summary(n).Mobility_Session2_Pass == 1 && isempty(C7_saline_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C7_saline_RM = RM;
        C7_saline_Shuffle = RM_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'C57_7') && strcmp(Data_Summary(n).drug,'saline')   && ~isempty(C7_saline_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C7_saline_RM = cat(1,C7_saline_RM,RM);
        C7_saline_Shuffle = cat(1,C7_saline_Shuffle,RM_Shuffle);
    end
end
[C7sf,C7sx,C7slow,C7shigh] = ecdf(C7_saline_RM,'Function','cdf','Alpha',0.05);
[C7ssf,C7ssx,C7sslow,C7sshigh] = ecdf(C7_saline_Shuffle,'Function','cdf','Alpha',0.05);

C8_saline_RM = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'C57_8') && strcmp(Data_Summary(n).drug,'saline') && Data_Summary(n).Mobility_Session1_Pass == 1 && Data_Summary(n).Mobility_Session2_Pass == 1 && isempty(C8_saline_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C8_saline_RM = RM;
        C8_saline_Shuffle = RM_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'C57_8') && strcmp(Data_Summary(n).drug,'saline')   && ~isempty(C8_saline_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C8_saline_RM = cat(1,C8_saline_RM,RM);
        C8_saline_Shuffle = cat(1,C8_saline_Shuffle,RM_Shuffle);
    end
end
[C8sf,C8sx,C8slow,C8shigh] = ecdf(C8_saline_RM,'Function','cdf','Alpha',0.05);
[C8ssf,C8ssx,C8sslow,C8sshigh] = ecdf(C8_saline_Shuffle,'Function','cdf','Alpha',0.05);

%% Organize data for WT saline

% get WT saline CDF mean
A = cat(1,C5sf,C6sf,C7sf,C8sf);
saline_F = sort(A);
saline_F = cat(1, 0, saline_F, 1);

% get WT saline CDF x-steps
B = cat(1,C5sx,C6sx,C7sx,C8sx);
saline_X = sort(B);
saline_X = cat(1, -1, saline_X, 1);

% get WT saline CDF high bound mean
C = cat(1,C5shigh,C6shigh,C7shigh,C8shigh);
saline_H = sort(C);

% get WT saline CDF low bound mean
D = cat(1,C5slow,C6slow,C7slow,C8slow);
saline_L = sort(D);


%% C57 cpp1 data
C5_cpp1_RM = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'C57_5') && strcmp(Data_Summary(n).drug,'(R)-CPP 1mg/kg') && Data_Summary(n).Mobility_Session1_Pass == 1 && Data_Summary(n).Mobility_Session2_Pass == 1 && isempty(C5_cpp1_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C5_cpp1_RM = RM;
        C5_cpp1_Shuffle = RM_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'C57_5') && strcmp(Data_Summary(n).drug,'(R)-CPP 1mg/kg')   && ~isempty(C5_cpp1_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C5_cpp1_RM = cat(1,C5_cpp1_RM,RM);
        C5_cpp1_Shuffle = cat(1,C5_cpp1_Shuffle,RM_Shuffle);
    end
end
[C5sf,C5sx,C5slow,C5shigh] = ecdf(C5_cpp1_RM,'Function','cdf','Alpha',0.05);
[C5ssf,C5ssx,C5sslow,C5sshigh] = ecdf(C5_cpp1_Shuffle,'Function','cdf','Alpha',0.05);

C6_cpp1_RM = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'C57_6') && strcmp(Data_Summary(n).drug,'(R)-CPP 1mg/kg') && Data_Summary(n).Mobility_Session1_Pass == 1 && Data_Summary(n).Mobility_Session2_Pass == 1 && isempty(C6_cpp1_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C6_cpp1_RM = RM;
        C6_cpp1_Shuffle = RM_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'C57_6') && strcmp(Data_Summary(n).drug,'(R)-CPP 1mg/kg')   && ~isempty(C6_cpp1_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C6_cpp1_RM = cat(1,C6_cpp1_RM,RM);
        C6_cpp1_Shuffle = cat(1,C6_cpp1_Shuffle,RM_Shuffle);
    end
end
[C6sf,C6sx,C6slow,C6shigh] = ecdf(C6_cpp1_RM,'Function','cdf','Alpha',0.05);
[C6ssf,C6ssx,C6sslow,C6sshigh] = ecdf(C6_cpp1_Shuffle,'Function','cdf','Alpha',0.05);

C7_cpp1_RM = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'C57_7') && strcmp(Data_Summary(n).drug,'(R)-CPP 1mg/kg') && Data_Summary(n).Mobility_Session1_Pass == 1 && Data_Summary(n).Mobility_Session2_Pass == 1 && isempty(C7_cpp1_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C7_cpp1_RM = RM;
        C7_cpp1_Shuffle = RM_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'C57_7') && strcmp(Data_Summary(n).drug,'(R)-CPP 1mg/kg')   && ~isempty(C7_cpp1_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C7_cpp1_RM = cat(1,C7_cpp1_RM,RM);
        C7_cpp1_Shuffle = cat(1,C7_cpp1_Shuffle,RM_Shuffle);
    end
end
[C7sf,C7sx,C7slow,C7shigh] = ecdf(C7_cpp1_RM,'Function','cdf','Alpha',0.05);
[C7ssf,C7ssx,C7sslow,C7sshigh] = ecdf(C7_cpp1_Shuffle,'Function','cdf','Alpha',0.05);

C8_cpp1_RM = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'C57_8') && strcmp(Data_Summary(n).drug,'(R)-CPP 1mg/kg') && Data_Summary(n).Mobility_Session1_Pass == 1 && Data_Summary(n).Mobility_Session2_Pass == 1 && isempty(C8_cpp1_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C8_cpp1_RM = RM;
        C8_cpp1_Shuffle = RM_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'C57_8') && strcmp(Data_Summary(n).drug,'(R)-CPP 1mg/kg')   && ~isempty(C8_cpp1_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C8_cpp1_RM = cat(1,C8_cpp1_RM,RM);
        C8_cpp1_Shuffle = cat(1,C8_cpp1_Shuffle,RM_Shuffle);
    end
end
[C8sf,C8sx,C8slow,C8shigh] = ecdf(C8_cpp1_RM,'Function','cdf','Alpha',0.05);
[C8ssf,C8ssx,C8sslow,C8sshigh] = ecdf(C8_cpp1_Shuffle,'Function','cdf','Alpha',0.05);

%% Organize data for WT cpp1

% get WT cpp1 CDF mean
A = cat(1,C5sf,C6sf,C7sf,C8sf);
cpp1_F = sort(A);
cpp1_F = cat(1, 0, cpp1_F, 1);

% get WT cpp1 CDF x-steps
B = cat(1,C5sx,C6sx,C7sx,C8sx);
cpp1_X = sort(B);
cpp1_X = cat(1, -1, cpp1_X, 1);

% get WT cpp1 CDF high bound mean
C = cat(1,C5shigh,C6shigh,C7shigh,C8shigh);
cpp1_H = sort(C);

% get WT cpp1 CDF low bound mean
D = cat(1,C5slow,C6slow,C7slow,C8slow);
cpp1_L = sort(D);

%% C57 cpp3 data
C5_cpp3_RM = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'C57_5') && strcmp(Data_Summary(n).drug,'(R)-CPP 3mg/kg') && Data_Summary(n).Mobility_Session1_Pass == 1 && Data_Summary(n).Mobility_Session2_Pass == 1 && isempty(C5_cpp3_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C5_cpp3_RM = RM;
        C5_cpp3_Shuffle = RM_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'C57_5') && strcmp(Data_Summary(n).drug,'(R)-CPP 3mg/kg')   && ~isempty(C5_cpp3_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C5_cpp3_RM = cat(1,C5_cpp3_RM,RM);
        C5_cpp3_Shuffle = cat(1,C5_cpp3_Shuffle,RM_Shuffle);
    end
end
[C5sf,C5sx,C5slow,C5shigh] = ecdf(C5_cpp3_RM,'Function','cdf','Alpha',0.05);
[C5ssf,C5ssx,C5sslow,C5sshigh] = ecdf(C5_cpp3_Shuffle,'Function','cdf','Alpha',0.05);

C6_cpp3_RM = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'C57_6') && strcmp(Data_Summary(n).drug,'(R)-CPP 3mg/kg') && Data_Summary(n).Mobility_Session1_Pass == 1 && Data_Summary(n).Mobility_Session2_Pass == 1 && isempty(C6_cpp3_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C6_cpp3_RM = RM;
        C6_cpp3_Shuffle = RM_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'C57_6') && strcmp(Data_Summary(n).drug,'(R)-CPP 3mg/kg')   && ~isempty(C6_cpp3_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C6_cpp3_RM = cat(1,C6_cpp3_RM,RM);
        C6_cpp3_Shuffle = cat(1,C6_cpp3_Shuffle,RM_Shuffle);
    end
end
[C6sf,C6sx,C6slow,C6shigh] = ecdf(C6_cpp3_RM,'Function','cdf','Alpha',0.05);
[C6ssf,C6ssx,C6sslow,C6sshigh] = ecdf(C6_cpp3_Shuffle,'Function','cdf','Alpha',0.05);

C7_cpp3_RM = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'C57_7') && strcmp(Data_Summary(n).drug,'(R)-CPP 3mg/kg') && Data_Summary(n).Mobility_Session1_Pass == 1 && Data_Summary(n).Mobility_Session2_Pass == 1 && isempty(C7_cpp3_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C7_cpp3_RM = RM;
        C7_cpp3_Shuffle = RM_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'C57_7') && strcmp(Data_Summary(n).drug,'(R)-CPP 3mg/kg')   && ~isempty(C7_cpp3_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C7_cpp3_RM = cat(1,C7_cpp3_RM,RM);
        C7_cpp3_Shuffle = cat(1,C7_cpp3_Shuffle,RM_Shuffle);
    end
end
[C7sf,C7sx,C7slow,C7shigh] = ecdf(C7_cpp3_RM,'Function','cdf','Alpha',0.05);
[C7ssf,C7ssx,C7sslow,C7sshigh] = ecdf(C7_cpp3_Shuffle,'Function','cdf','Alpha',0.05);

C8_cpp3_RM = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'C57_8') && strcmp(Data_Summary(n).drug,'(R)-CPP 3mg/kg') && Data_Summary(n).Mobility_Session1_Pass == 1 && Data_Summary(n).Mobility_Session2_Pass == 1 && isempty(C8_cpp3_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C8_cpp3_RM = RM;
        C8_cpp3_Shuffle = RM_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'C57_8') && strcmp(Data_Summary(n).drug,'(R)-CPP 3mg/kg')   && ~isempty(C8_cpp3_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C8_cpp3_RM = cat(1,C8_cpp3_RM,RM);
        C8_cpp3_Shuffle = cat(1,C8_cpp3_Shuffle,RM_Shuffle);
    end
end
[C8sf,C8sx,C8slow,C8shigh] = ecdf(C8_cpp3_RM,'Function','cdf','Alpha',0.05);
[C8ssf,C8ssx,C8sslow,C8sshigh] = ecdf(C8_cpp3_Shuffle,'Function','cdf','Alpha',0.05);

%% Organize data for WT cpp3

% get WT cpp3 CDF mean
A = cat(1,C5sf,C6sf,C7sf,C8sf);
cpp3_F = sort(A);
cpp3_F = cat(1, 0, cpp3_F, 1);

% get WT cpp3 CDF x-steps
B = cat(1,C5sx,C6sx,C7sx,C8sx);
cpp3_X = sort(B);
cpp3_X = cat(1, -1, cpp3_X, 1);

% get WT cpp3 CDF high bound mean
C = cat(1,C5shigh,C6shigh,C7shigh,C8shigh);
cpp3_H = sort(C);

% get WT cpp3 CDF low bound mean
D = cat(1,C5slow,C6slow,C7slow,C8slow);
cpp3_L = sort(D);


%% C57 cpp10 data
C5_cpp10_RM = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'C57_5') && strcmp(Data_Summary(n).drug,'(R)-CPP 10mg/kg') && Data_Summary(n).Mobility_Session1_Pass == 1 && Data_Summary(n).Mobility_Session2_Pass == 1 && isempty(C5_cpp10_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C5_cpp10_RM = RM;
        C5_cpp10_Shuffle = RM_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'C57_5') && strcmp(Data_Summary(n).drug,'(R)-CPP 10mg/kg')   && ~isempty(C5_cpp10_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C5_cpp10_RM = cat(1,C5_cpp10_RM,RM);
        C5_cpp10_Shuffle = cat(1,C5_cpp10_Shuffle,RM_Shuffle);
    end
end
[C5sf,C5sx,C5slow,C5shigh] = ecdf(C5_cpp10_RM,'Function','cdf','Alpha',0.05);
[C5ssf,C5ssx,C5sslow,C5sshigh] = ecdf(C5_cpp10_Shuffle,'Function','cdf','Alpha',0.05);

C6_cpp10_RM = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'C57_6') && strcmp(Data_Summary(n).drug,'(R)-CPP 10mg/kg') && Data_Summary(n).Mobility_Session1_Pass == 1 && Data_Summary(n).Mobility_Session2_Pass == 1 && isempty(C6_cpp10_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C6_cpp10_RM = RM;
        C6_cpp10_Shuffle = RM_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'C57_6') && strcmp(Data_Summary(n).drug,'(R)-CPP 10mg/kg')   && ~isempty(C6_cpp10_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C6_cpp10_RM = cat(1,C6_cpp10_RM,RM);
        C6_cpp10_Shuffle = cat(1,C6_cpp10_Shuffle,RM_Shuffle);
    end
end
[C6sf,C6sx,C6slow,C6shigh] = ecdf(C6_cpp10_RM,'Function','cdf','Alpha',0.05);
[C6ssf,C6ssx,C6sslow,C6sshigh] = ecdf(C6_cpp10_Shuffle,'Function','cdf','Alpha',0.05);

C7_cpp10_RM = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'C57_7') && strcmp(Data_Summary(n).drug,'(R)-CPP 10mg/kg') && Data_Summary(n).Mobility_Session1_Pass == 1 && Data_Summary(n).Mobility_Session2_Pass == 1 && isempty(C7_cpp10_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C7_cpp10_RM = RM;
        C7_cpp10_Shuffle = RM_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'C57_7') && strcmp(Data_Summary(n).drug,'(R)-CPP 10mg/kg')   && ~isempty(C7_cpp10_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C7_cpp10_RM = cat(1,C7_cpp10_RM,RM);
        C7_cpp10_Shuffle = cat(1,C7_cpp10_Shuffle,RM_Shuffle);
    end
end
[C7sf,C7sx,C7slow,C7shigh] = ecdf(C7_cpp10_RM,'Function','cdf','Alpha',0.05);
[C7ssf,C7ssx,C7sslow,C7sshigh] = ecdf(C7_cpp10_Shuffle,'Function','cdf','Alpha',0.05);

C8_cpp10_RM = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'C57_8') && strcmp(Data_Summary(n).drug,'(R)-CPP 10mg/kg') && Data_Summary(n).Mobility_Session1_Pass == 1 && Data_Summary(n).Mobility_Session2_Pass == 1 && isempty(C8_cpp10_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C8_cpp10_RM = RM;
        C8_cpp10_Shuffle = RM_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'C57_8') && strcmp(Data_Summary(n).drug,'(R)-CPP 10mg/kg')   && ~isempty(C8_cpp10_RM)
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C8_cpp10_RM = cat(1,C8_cpp10_RM,RM);
        C8_cpp10_Shuffle = cat(1,C8_cpp10_Shuffle,RM_Shuffle);
    end
end
[C8sf,C8sx,C8slow,C8shigh] = ecdf(C8_cpp10_RM,'Function','cdf','Alpha',0.05);
[C8ssf,C8ssx,C8sslow,C8sshigh] = ecdf(C8_cpp10_Shuffle,'Function','cdf','Alpha',0.05);

%% Organize data for WT cpp10

% get WT cpp10 CDF mean
A = cat(1,C5sf,C6sf,C7sf,C8sf);
cpp10_F = sort(A);
cpp10_F = cat(1, 0, cpp10_F, 1);

% get WT cpp10 CDF x-steps
B = cat(1,C5sx,C6sx,C7sx,C8sx);
cpp10_X = sort(B);
cpp10_X = cat(1, -1, cpp10_X, 1);

% get WT cpp10 CDF high bound mean
C = cat(1,C5shigh,C6shigh,C7shigh,C8shigh);
cpp10_H = sort(C);

% get WT cpp10 CDF low bound mean
D = cat(1,C5slow,C6slow,C7slow,C8slow);
cpp10_L = sort(D);


%% Finally, put shuffle data together

% get shuffle CDF mean
A = cat(1,C5ssf,C6ssf,C7ssf,C8ssf);
Shuffle_F = sort(A);
Shuffle_F = cat(1, 0, Shuffle_F, 1);

% get shuffle CDF x-steps
B = cat(1,C5ssx,C6ssx,C7ssx,C8ssx);
Shuffle_X = sort(B);
Shuffle_X = cat(1, -1, Shuffle_X, 1);

%% plot all data

figure
plot(saline_X,saline_F,'Color','#2AF598','LineWidth',3);
hold on
plot(cpp1_X,cpp1_F,'Color','#1BD7BB','LineWidth',3);
hold on
plot(cpp3_X,cpp3_F,'Color','#08B3E5','LineWidth',3);
hold on
plot(cpp10_X,cpp10_F,'Color','#003193','LineWidth',3);
hold on
plot(Shuffle_X, Shuffle_F,'-k','LineWidth',3);
xlabel('RM Correlation Value')
ylabel('Cumulative Fraction of Locations')
xlim([-0.6,1])
set(gca,'FontSize',15)
legend('saline', '(R)-CPP 1mg/kg', '3mg/kg', '10mg/kg', 'shuffle', 'Location', 'SouthEast', 'FontSize', 15)
% set(gca, 'Visible', 'off')
hold off


end